<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>mycms{:lang('ADMIN_CENTER')}</title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="robots" content="noindex,nofollow">
    <link rel="stylesheet" href="__TMPL__/ui/css/login.css">
    <script type="text/javascript" src="__TMPL__/ui/js/jquery.min.js"></script>
    <script src="__TMPL__/ui/lib/layui/layui.js" charset="utf-8"></script>
    <script>
        if (window.parent !== window.self) {
            document.write = '';
            window.parent.location.href = window.self.location.href;
            setTimeout(function () {
                document.body.innerHTML = '';
            }, 0);
        }
    </script>
</head>
<body class="login-bg">
<canvas id="fullstarbg">你的浏览器不支持canvas标签</canvas>
<div class="login">
    <div class="message">麦研信息化平台</div>
    <div id="darkbannerwrap"></div>
    <form class="layui-form" method="post">
        <input type="text" id="input_username" class="layui-input" name="username"
               placeholder="{:lang('USERNAME_OR_EMAIL')}" lay-verify="username" title="{:lang('USERNAME_OR_EMAIL')}"
               value="{:cookie('admin_username')}" data-rule-required="true" data-msg-required="">
        <hr class="hr15">
        <input type="password" id="input_password" lay-verify="password" class="layui-input" name="password"
               placeholder="{:lang('PASSWORD')}" title="{:lang('PASSWORD')}" data-rule-required="true"
               data-msg-required="">

        <hr class="hr15">
        <input type="text" style="width: 50%" name="captcha" placeholder="验证码" lay-verify="yzm"
               class="form-control captcha">
        <captcha font-size="18"
                 style="cursor: pointer;"/>

        <hr class="hr15">
        <input type="hidden" name="redirect" value="">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr20">
    </form>
</div>
</div>
<script type="text/javascript">
    //全局变量
    var GV = {
        ROOT: "__ROOT__/",
        WEB_ROOT: "__WEB_ROOT__/",
        JS_ROOT: "static/js/",
        APP: ''/*当前应用名*/
    };
</script>
<script>
    layui.use(['form'],
        function () {
            $ = layui.jquery;
            var form = layui.form(),
                layer = layui.layer;

            //监听提交
            form.verify({
                username: function (value) {
                    if (value.length < 1) {
                        return '用户名不能为空';
                    }
                }, password: function (value) {
                    if (value.length < 1) {
                        return '密码不能为空';
                    }
                }, yzm: function (value) {
                    if (value.length < 1) {
                        return '验证码不能为空';
                    }
                }
            });

            form.on('submit(login)', function (data) {
                var url = "{:url('public/doLogin')}";
                $.post(url, data.field, function (res) {
                    if (res.code == 1) {
                        location.href = res.url;
                    } else {
                        layer.alert(res.msg,function () {
                            location.reload();
                        });
                    }
                });
                return false;
            });

        });

</script>
<script src="__TMPL__/public/assets/js/jquery-1.10.2.min.js"></script>
<script src="__STATIC__/js/wind.js"></script>
<script src="__STATIC__/js/admin.js"></script>
<script>
    (function () {
        document.getElementById('input_username').focus();
    })();
</script>
</body>
</html>
